﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

/// <summary>
/// Summary description for Policy
/// </summary>
public class Policy
{
    private int policyId;
    private int userId;
    private string insuranceType;
    private int policyValue;
    private string period;
    private float premium;
    private DateTime contractDate;
    private bool paid;

    public int PolicyId
    {
        get { return policyId; }
        set { policyId = value; }
    }
    

    public int UserId
    {
        get { return userId; }
        set { userId = value; }
    }    

    public string InsuranceType
    {
        get { return insuranceType; }
        set { insuranceType = value; }
    }    

    public int PolicyValue
    {
        get { return policyValue; }
        set { policyValue = value; }
    }
    

    public string Period
    {
        get { return period; }
        set { period = value; }
    }
    

    public float Premium
    {
        get { return premium; }
        set { premium = value; }
    }    

    public DateTime ContractDate
    {
        get { return contractDate; }
        set { contractDate = value; }
    }

    public bool Paid
    {
        get { return paid; }
        set { paid = value; }
    }

    public Policy()
    {

    }

    public Policy(int policyId, int userId, string insuranceType, int policyValue, string period, float premium, DateTime contractDate,bool paid)
	{
        this.policyId = policyId;
        this.userId = userId;
        this.insuranceType = insuranceType;
        this.policyValue = policyValue;
        this.period = period;
        this.premium = premium;
        this.contractDate = contractDate;
        this.paid = paid;
	}
    public void status()
    {
        BillBll bbll = new BillBll();
        if (PolicyValue > bbll.getBillPaidByPolicyId(PolicyId))
            Paid = false;
        else Paid = true;        
    }
}
